package cn.px.dao.bean;

import com.github.pagehelper.Page;
import cn.px.common.bean.AbstractPageResultBean;

import java.util.List;

/**
 * @Description page对象实现
 * @author 品讯科技
 * @date 2024-08
 * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
 */
public class MyPage<T> extends AbstractPageResultBean<T> {

    public MyPage(List<T> rows) {
        super(rows);
    }

    @Override
    protected void init(List rows) {
        if (rows instanceof Page) {
            Page<T> page = (Page<T>) rows;
            this.setTotal(page.getTotal());
            this.setRows(page.getResult());
            this.setPageNum(page.getPageNum());
            this.setPageSize(page.getPageSize());
            this.setPages(page.getPages());
        }
    }

}
